<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text">
    <button>点击提交</button>
</body>
</html>

<script>
    var input = document.querySelector('input')
    var btn = document.querySelector('button')
    btn.disabled = true  
    var reg = /^\d{6,11}$/

    input.oninput = function(){
        if (reg.test(input.value)) {
            btn.disabled = false
        }
        else{
            btn.disabled = true          
        }
    }

</script>

<!-- 无重点，基础正则的运用 -->

<!-- 拓展：
匹配页面上所有img标签的src

var str = "<img src='12.png'/>"

var regExp = /<img\s+src=['"]([^'"]*)['"][.]*\/>/

console.log(regExp.exec(str)); -->



<!-- $parrern = '/<img.*?src="(.*?)".*?\/?>/i';  //i忽略大小写 括号中内容放到内存中 -->